# Replication for the four subgropus referred to in the analysis
# Krawatzek / Soroka
# Defending History? The Impact of Context and Speaker in Russia
# Perspectives on Politics
# DOI

require(stats)
require(stargazer)
setwd("Insert your local directory")
load("RegressionDataSubgroups.RData")

M1 <- glm(GroupRevisionist ~ A1Age + A2GenderMale + A3Capital + A12SectorEconomyPublicPrivate + A18Education + AWealth, 
          family = binomial(link = "logit"), data = RegressionData)
M2 <- glm(GroupCritical ~ A1Age + A2GenderMale + A3Capital + A12SectorEconomyPublicPrivate + A18Education + AWealth, 
          family = binomial(link = "logit"), data = RegressionData)
M3 <- glm(GroupNoClearView ~ A1Age + A2GenderMale + A3Capital + A12SectorEconomyPublicPrivate + A18Education + AWealth, 
          family = binomial(link = "logit"), data = RegressionData)
M4 <- glm(GroupPoliticallyLoyal ~ A1Age + A2GenderMale + A3Capital + A12SectorEconomyPublicPrivate + A18Education + AWealth, 
          family = binomial(link = "logit"), data = RegressionData)

Models <- list(M1, M2, M3, M4)
stargazer(Models, p.auto=FALSE,
          star.cutoffs = c(0.05, 0.01, 0.001),
          column.labels   = c("Revisionist", "Critical", "Unclear", "Politically loyal"),model.names=TRUE,
          digits=3, type="html", title = "Structure political and historical views",
          out="Group analysis Structure political and historical views.doc")